home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************************/
- /* FunctionTemplate.c */
- /* */
- /* */
- /* Version 15.12.95 */
- /***************************************************************************************/
-
-
- #include "proFit_interface.h"
-
-
-
- /***************************************************************************************/
-
- void SetUp ( short* const moduleKind, /* set moduleKind to isFunction or isProgram */
- Str255 name, /* the name of the program or function (pascal string) */
- long* const requiredGlobals, /* the number of bytes to be allocated in ExtModulesParamBlock.globals */
- /* set requiredGlobals to 0 if you don't use this feature */
- ExtModulesParamBlock* pb) /* the complete parameter block passed by pro Fit to the */
- /* routines defined in this file. In most cases it can be ignored */
- /* SetUp is called once when the external module is linked to proFit */
- {
- *moduleKind=isFunction; /* we define a function */
- SetPascalStr(name,"\p",255); /* write its name here */
- *requiredGlobals = 0; /* leave this like it is now if you don't need to allocate global variable */
- /* space using a pointer.*/
- /* set this to a pointer size if you want to use*/
- /* the pointer "globals" provided in ExtModulesParamBlock*/
- }
-
- /***************************************************************************************/
-
- void InitializeFunc (
- Boolean* const hasDerivatives, /* set this to true if you do calculate some derivatives (dyda[]) in the */
- /* "Derivatives" function you define. Any derivatives you don't calculate will be calculated numerically by pro Fit */
- Str255 descr1stLine, /* first line of the text in the parameter window */
- Str255 descr2ndLine, /* second line of the text in the parameter window */
- short* const numberOfParams, /* the number of parameters of the function */
- DefaultParamInfo* const a0, /* the default names, values etc. of the parameters */
- ExtModulesParamBlock* pb) /* the complete parameter block passed by pro Fit */
- /* InitializeFunc is called once (after SetUp has been called) when the external module is linked to proFit */
- /* Used to set all the information needed to describe a function */
- {
-
- }
-
-
- /***************************************************************************************/
-
- short Check( short paramNo, /* the parameter that was changed */
- DefaultParamInfo* const a0, /* the default names, values etc of the paramters */
- ExtModulesParamBlock* pb) /* the complete parameter block passed by pro Fit */
- /* Can be left emtpy (returning good) if not needed. */
- /* called when the user has changed a value in the parameters window. This routine */
- /* can then check if this parameters is fine. It can also change some of the */
- /* other entries in a0. The returned values can be: */
- /* good: return this value if you agree with the new parameter value */
- /* update: return this value if you want the parameters window */
- /* to be updated because you changed some of the values in a0 */
- /* bad: return this value if you want the new parameter value to be refused */
-
- { paramNo--;/*the array a0 is indexed from zero. Decrement paramNo so that it corresponds to the inideces of a0*/
- return ok;
- }
-
- /***************************************************************************************/
-
- void First ( ParamArray a, /* the new parameters */
- ExtModulesParamBlock* pb) /* the complete parameter block passed by pro Fit */
- /* Can be left emtpy if not needed. */
- /* Called whenever the parameters are changed. Can be used to accelerate */
- /* some calculations. See manual for more info */
- {
-
- }
-
-
-
- /***************************************************************************************/
-
- void Func ( double x, /* the x-value */
- ParamArray a, /* the parameters */
- double* const y, /* the y-value to be returned */
- ExtModulesParamBlock* pb) /* the complete parameter block passed by pro Fit */
- /* called to calculate the y-value of the function for a given x and a given */
- /* set of parameters */
- {
-
- }
-
-
-
- /***************************************************************************************/
-
- void Derivatives(double x, /* the x-value */
- ParamArray a, /* the parameters */
- ParamArray dyda, /* the derivatives to be returned */
- ExtModulesParamBlock* pb) /* the complete parameter block passed by pro Fit */
- /* called to calculate the partial derivatives of the function with respect to */
- /* its parameters. The elements of the array "dyda[i]" must be set to the derivatives of */
- /* the function with respect to parameter number "i". If any dyda[i] is not set by */
- /* this function, then the derivatives will be calculated numerically by pro Fit. */
- /* If you set hasDerivatives to false in FuncInitialize, then ALL derivatives will always */
- /* be calcuated numerically by pro Fit, no matter what you do in the function "Derivatives" */
- /* If a derivative is too complicated to be calculated analytically, then don't set the */
- /* corresponding "dyda". pro Fit will notice this and calculate that derivative numerically. */
- /* If you are able to calculate the dyda analytically, do so! By doing this you will make */
- /* fitting much, much faster. */
- {
-
- }
-
-
- /***************************************************************************************/
-
- void Last (ExtModulesParamBlock* pb)
- /* Can be left emtpy if not needed. */
- /* Called when calculating is through. See manual for more info */
- {
-
- }
-
- /***************************************************************************************/
-
- void CleanUp (ExtModulesParamBlock* pb)
- /* called when the function or program is removed from pro Fit's menus */
- /* in most cases, this function can be empty */
- {
-
- }
-
-
-
-
-
-
-
-
-
- /***************************************************************************************/
- /* for programs, not used here: */
- /***************************************************************************************/
-
-
-
- void InitializeProg (ExtModulesParamBlock* pb)
- {}
-
- void Run(ExtModulesParamBlock* pb)
- {}
-